<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets a client-side timeout for this query</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="mongocursorinterface.setreadpreference.html">« MongoCursorInterface::setReadPreference</a></li>
      <li style="float: right;"><a href="class.mongocommandcursor.html">MongoCommandCursor »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.mongocursorinterface.html">MongoCursorInterface</a></li>
    <li>Sets a client-side timeout for this query</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="mongocursorinterface.timeout" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoCursorInterface::timeout</h1>
  <p class="verinfo">(PECL mongo &gt;=1.5.0)</p><p class="refpurpose"><span class="refname">MongoCursorInterface::timeout</span> &mdash; <span class="dc-title">Sets a client-side timeout for this query</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongocursorinterface.timeout-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">abstract</span> <span class="modifier">public</span> <span class="methodname"><strong>MongoCursorInterface::timeout</strong></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$ms</code></span>): <span class="type"><a href="class.mongocursorinterface.html" class="type MongoCursorInterface">MongoCursorInterface</a></span></div>

  <p class="para rdfs-comment">
   A timeout can be set at any time and will affect subsequent data retrieval
   associated with this cursor, including fetching more results from the
   database.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mongocursorinterface.timeout-parameters">
  <h3 class="title">Parameters</h3>
  <dl>

   
    <dt>

     <code class="parameter">ms</code>
    </dt>

    <dd>

     <p class="para">
      The number of milliseconds for the cursor to wait for a response. Use
      <code class="literal">-1</code> to wait forever. By default, the cursor will wait
      <var class="varname">30000</var> milliseconds (30 seconds).
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongocursorinterface.timeout-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns this cursor.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-mongocursorinterface.timeout-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
   Causes methods that fetch results to throw a
   <a href="class.mongocursortimeoutexception.html" class="classname">MongoCursorTimeoutException</a> if the data fetch takes
   longer than the specified number of milliseconds.
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-mongocursorinterface.timeout-seealso">
  <h3 class="title">See Also</h3>
  <ul class="simplelist">
   <li class="member">The <code class="literal">socketTimeoutMS</code> option for <span class="function"><a href="mongoclient.construct.html" class="function">MongoClient::__construct()</a></span></li>
  </ul>
 </div>

</div></div></div></body></html>